/**
 * libnlog -- User friendly logging system with network support.
 *
 * Copyright (C) 2011
 * 	Samuel Nussbaum <samuel (dot) nussbaum (at) e-robot.ch>
 *
 * This library is free software; you can redistribute it and/or modify it under the terms of the
 * GNU Lesser General Public License as published by the Free Software Foundation; either version 3
 * of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License along with this
 * library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301 USA
 */
#include "Stream.hpp"
#include "Logger.hpp"

namespace nlog {

Stream::Stream(LevelEnum _level, const Logger &_target) :
	m_message(_level, _target.name()), m_target(_target) {
	/* Nothing to do... */
}

Stream::Stream(const Stream &_other) :
	m_message(_other.m_message), m_target(_other.m_target) {
	m_stream << _other.m_stream.str();
}

Stream::~Stream() {
	m_message.setContent(m_stream.str());
	m_target.write(m_message);
}

}
